package com.redis.base.multiple;

public abstract class AbstractRedis {

	
	protected  final String LOCK = "lock_";
	
	protected static final int DEFAULT_SPIN_NUM = 2;
	
	
	
	protected String getLockKey(String key) {
		return LOCK + key;
	}
	
	
	protected static String getKey(String ... keys){
		if(keys == null || keys.length <=0 ){
			return "";
		}
		StringBuilder sb = new StringBuilder();
		for(String key : keys){
			sb.append(key+"_");
		}
		if(sb.toString().endsWith("_")){
			sb.delete(sb.length()-1, sb.length());
		}
		return String.valueOf(sb);
	}
	
	protected Integer getSpinNum(int spinNumn,Integer defalutNum){
		if(spinNumn > 0){
			return spinNumn;
		}
		
		return defalutNum;
	}
	
}
